<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('terminalType列表')" />
</head>

<body class="gray-bg">
<div class="container">


    <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#packinformation">
        开始演示模态框
    </button>
    <!-- 模态框（Modal） -->
    <div class="modal fade" id="packinformation" tabindex="-1" role="dialog" aria-labelledby="packinformationLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="packinformationLabel">
                        电池箱参数详细参数
                    </h4>
                </div>
                <form class="form-horizontal m" id="form-information-edit" >
                    <div class="form-group">
                        <label class="col-sm-3 control-label">工作电压：</label>
                        <div class="col-sm-8">
                            <input id="workingVoltage" class="form-control" type="text" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">固件版本号：</label>
                        <div class="col-sm-8">
                            <input id="firmwareVersionNumber" class="form-control" type="text" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">功耗：</label>
                        <div class="col-sm-8">
                            <input id="powerWiddipation" class="form-control" type="text" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">休眠电流：</label>
                        <div class="col-sm-8">
                            <input id="sleepCurrent" class="form-control" type="text" disabled>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">内置电池容量：</label>
                        <div class="col-sm-8">
                            <input id="batteryCapacity" class="form-control" type="text" disabled>
                        </div>
                    </div>

                    <!--                    <div class="form-group">-->
                    <!--                        <label class="col-sm-3 control-label">json关联电池模组：</label>-->
                    <!--                        <div class="col-sm-8">-->
                    <!--                            <input id="cellModelId" class="form-control" type="text" disabled>-->
                    <!--                        </div>-->
                    <!--                    </div>-->
                </form>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭
                    </button>
                </div>
            </div><!-- /.modal-content -->
        </div><!-- /.modal -->
    </div>

<script th:inline="javascript">
    window.onload=function(){
        $('body').on('hidden', '.modal', function () {
            $(this).removeData('modal');
        });
    }
    window.operateEvents = {
        'click #cs': function (e, value, row, index) {
            alert(value);
             $.ajax({
                 url:"/terminalInformation/terminalInformationById/"+value,
                 type:"get",
                 dataType:"json",
                 success:function (terminalInformationById) {
                     console.log(terminalInformationById);
                     $("#workingVoltage").val(terminalInformationById.workingVoltage);
                     $("#firmwareVersionNumber").val(terminalInformationById.firmwareVersionNumber);
                     $("#powerWiddipation").val(terminalInformationById.powerWiddipation);
                     $("#sleepCurrent").val(terminalInformationById.sleepCurrent);
                     $("#batteryCapacity").val(terminalInformationById.batteryCapacity);
                 }
             })
        }

    };
</script>
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>终端型号名称：</label>
                                <input type="text" name="terminalModelName"/>
                            </li>
                            <li>
                                <label>终端型号编号：</label>
                                <input type="text" name="terminalModelId"/>
                            </li>
                            <li>
                                <label>终端种类：</label>
                                <select name="terminalType">
                                    <option value="">所有</option>
                                    <option value="1">车机</option>
                                    <option value="2">T-Box</option>
                                    <option value="3">OBD</option>
                                    <option value="4">智能后视镜</option>
                                    <option value="5">智能行车记录仪</option>
                                </select>
                            </li>
                            <li>
                                <label>终端品牌：</label>
                                <input type="text" name="terminalBrand"/>
                            </li>
                            <li>
                                <label>生产厂商名称：</label>
                                <input type="text" name="manufacturersName"/>
                            </li>
                            <li>
                                <label>车载终端性能参数：</label>
                                <input type="text" name="carTerminalNumber"/>
                            </li>

                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:terminal:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:terminal:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:terminal:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:terminal:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:terminal:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:terminal:remove')}]];
        var prefix = ctx + "terminalType";


        function findOne (id) {
                alert(id);
                 $.ajax({
                     url:"/terminalType/terminalTypeById/"+id,
                     type:"get",
                     dataType:"json",
                     success:function (terminalInformationById) {
                         console.log(terminalInformationById);
                         $("#workingVoltage").val(terminalInformationById.workingVoltage);
                         $("#firmwareVersionNumber").val(terminalInformationById.firmwareVersionNumber);
                         $("#powerWiddipation").val(terminalInformationById.powerWiddipation);
                         $("#sleepCurrent").val(terminalInformationById.sleepCurrent);
                         $("#batteryCapacity").val(terminalInformationById.batteryCapacity);
                     }
                 })
            }
        $(function() {
            var options = {
                url: prefix + "/terminalTypeList",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/terminalTypeDelete",
                exportUrl: prefix + "/export",
                typeByIdUrl:prefix +"/terminalTypeById",
                modalName: "terminalType",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '车辆终端型号表主键id',
                    visible: false
                },
                {
                    field: 'terminalModelName',
                    title: '终端型号名称'
                },
                {
                    field: 'terminalModelId',
                    title: '终端型号编号'
                },
                {
                    field: 'terminalType',
                    title: '终端种类'
                },
                {
                    field: 'terminalBrand',
                    title: '终端品牌'
                },
                {
                    field: 'manufacturersName',
                    title: '生产厂商名称'
                },
                {
                    field: 'id',
                    title: '车载终端性能参数',
                    events: operateEvents,
                    formatter:function (value,row,index) {
                        return [
                            '<a data-toggle="modal" id="cs" data-target="#packinformation" onclick="findOne('+row.id+')">查看详细信息</a>'
                        ].join('');

                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>
